<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<!DOCTYPE html>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="from"%>
<html>
<head>
<meta charset="UTF-8">
<title><spring:message code="design_platform_name"/></title>
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/resources/easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/resources/easyui/themes/icon.css">
    <link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/resources/style/icon.css">
<script type="text/javascript" src="<%=request.getContextPath() %>/resources/easyui/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/resources/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/resources/easyui/locale/easyui-lang-zh_CN.js"></script>
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/resources/style/main.css">
<script type="text/javascript">
    var question_list = <%=request.getAttribute("questionJson")%>;
    var UrlConfig = {
        questionList: '<%=request.getContextPath() %>/question/list',
        questionPage: '<%=request.getContextPath() %>/question/page'
    };

    $(function () {
        $('#dg').datagrid({
            nowrap: true,
            data: question_list,
            onDblClickCell: function (row, field, value) {
                if (field == "body") {
                    console.log($(this).data);
                    console.log("cell was double clicked");
                    $('#multiBodyBox').prop('value', value);
                    $('#bodyWin').window('open').prop('value', row.body);

                }
            },


            onClickCell: function (row, field, value) {
                if (field == "id") {
                    $('#show_win').panel('refresh', '<%=request.getContextPath() %>/page/showDataBaseCases/' + value);
                }
            }

        });
    })
</script>
</head>
<body class="easyui-layout">
<div data-options="region:'north'" style="height:65px;overflow:hidden;">
            <table border="0" cellspacing="0" cellpadding="0" style="width:100%;">
        <tbody><tr>
            <td width="170" align="left"><div style="width:100%; height:69px; BACKGROUND-IMAGE: url(resources/images/ulogo.png);opacity:0.4;BACKGROUND-POSITION: left center; BACKGROUND-REPEAT: no-repeat;"></div></td>
            <td width="490" align="left"><div style="width:100%; height:69px; BACKGROUND-IMAGE: url(resources/images/schema-design-top.png);BACKGROUND-POSITION: left center; BACKGROUND-REPEAT: no-repeat;"></div></td>
            <td align="right">
                <div style="text-align:right; width:100%; height:68px; BACKGROUND-IMAGE: url(resources/images/topright.png);BACKGROUND-POSITION: right center; BACKGROUND-REPEAT: no-repeat; float: right">
                    <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
                        <tbody><tr>
                            <td id="task1" rowspan="1" valign="bottom">&nbsp;</td>
                            <td width="150"><TextBox style="font-weight: bold; font-size: 14px; font-family: 黑体"><spring:message code="case_design_welcome"/>${currentUser.userName}</TextBox></td>
                            <td width="55"><a  href="<%=request.getContextPath() %>/logout"><img src="resources/images/exit.png" width="17" height="17"/></a>
                            </td>
                            <td width="55">&nbsp;
                            </td>
                        </tr>
                    </tbody></table>
                </div>
            </td>
        </tr>
    </tbody></table>
</div>

<div class="easyui-panel" data-options="region:'west',split:true,title:'<spring:message code="accordion_title"/>',iconCls:'icon-help'" style="width:800px;padding:5px; text-align:left;">
    <div id="p" class="easyui-panel" title="问题列表" iconCls='icon-edit' style="width:800px;height:650px;">
                            <table id="dg" class="easyui-datagrid" style="width:1200px;height:540px"
                                   data-options="
				iconCls: 'icon-edit',
				singleSelect: true,
				toolbar: '#tb',
				data:question_list,
				method: 'get',
				rownumbers:true,
				pagination:true
			">

             <thead>
                   <tr>
                        <th data-options="field:'id',width:50">问题ID</th>
                        <th data-options="field:'title',width:150" >标题</th>
                        <th data-options="field:'body',width:300">问题内容</th>
                        <th data-options="field:'owneruserid',width:80">提问者</th>
                        <th data-options="field:'creationdate',width:100">提问时间</th>
                       <th id="startRec" style="width:50px">启动推荐</th>
                   </tr>
             </thead>
          </table>
    </div>
</div>
<div class="easyui-window" id="bodyWin" title="问题内容" minimizable="false" maximizable="false" closed="true" collapsible="false" style="position:relative;width:600px;height: 350px;">
    <textarea id="multiBodyBox" rows="18" cols="80" value=""></textarea>
</div>
<div data-options="region:'center'" title="<spring:message code='main_win_name'/>" style=" padding:10px; text-align:left;" >
  <div id="show_win" class="easyui-panel"></div>
</div>

<script type="text/javascript">
setInterval(function() {
	var url = '<%=request.getContextPath() %>/checkSession';
	$.get(url, function(result) {
		if (! result.successful) {
			window.location.href="<%=request.getContextPath() %>";
		}
	}, 'json');
}, 60000);
</script>
<script type="text/javascript">

</script>
<script type="text/javascript" src="<%=request.getContextPath() %>/resources/js/field-design.js">
</script>
</body>
</html>
